@ignore
Feature: Demo
Background:
* json cliConfig = snowflake.cliConfigFromEnv
* string jwtToken = snowflake.cli.generateJwtToken(cliConfig)
Scenario Outline: Burger Factory - <bread> + <vegetable> + <meat> = <output>
Given string clientId = "😋_"+lectra.uuid()
And table inserts
| table | value |
| "BREAD" | "<bread>" |
| "VEGETABLE" | "<vegetable>" |
| "MEAT" | "<meat>" |
And def genStatement = (row) => "INSERT INTO "+row.table+"(CLIENT_ID, VALUE) VALUES ('"+clientId+"','"+row.value+"')"
And json responses = karate.map(inserts, (row) => snowflake.rest.runSql({...cliConfig, jwtToken: jwtToken, snowflakeConfig: snowflakeConfigs[row.table], statement: genStatement(row)}).status)
And match each responses == "OK"
When string dbtConsoleOutput = karate.exec("dbt run")
And match dbtConsoleOutput contains "Completed successfully"
Then string selectStatement = "SELECT VALUE FROM BURGER WHERE CLIENT_ID='"+clientId+"'"
And json response = snowflake.rest.runSql({...cliConfig, snowflakeConfig: snowflakeConfigs.BURGER, statement: selectStatement })
And match response.data == [ { "VALUE" : "<output>" } ]
Examples:
| bread | vegetable | meat | output |
| 🍞 | 🍅 | 🥩 | 🍔 |
| 🍞 | 🍅 | 🍗 | 🍔 |
| 🍞 | 🍅 | 🐟 | 🍔 |
| 🍞 | 🥕 | 🥩 | 🍞 + 🥕 + 🥩 |